<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>发布二手车信息</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="mok/usedcar/css/addUsedCarSale.css">

		<script type="text/javascript" src="js/common.js"></script>

		<script type="text/javascript" src="dwr/engine.js"></script>
		<script type="text/javascript" src="dwr/util.js"></script>
		<script type="text/javascript" src="dwr/interface/basicCarService.js"></script>

		<script type="text/javascript">
			function brandChange(value){
				var brand = document.getElementById('brand'); 
				var department = document.getElementById('department');
				var carType = document.getElementById('carType');
				dwr.engine.setAsync(false);
				basicCarService.getDepartmentListByBrand(value, 
					function (data){
						department.options.length = 1;
						for(var i = 0; i < data.length; i++){
							department.options.add(new Option(data[i]));
						}
						carType.style.display = "none";
					}
				);
				dwr.engine.setAsync(true);
				if(value == 0){
					department.style.display = "none";
					carType.style.display = "none";
					return;
				}
				department.style.display = "block";
			}
			function departmentChange(value){
				var carType = document.getElementById('carType');
				
				dwr.engine.setAsync(false);
				basicCarService.getCarTypeListByDepartment(value, 
					function (data){
						carType.options.length = 1;
						for(var i = 0; i < data.length; i++){
							carType.options.add(new Option(data[i]));
						}
					}
				);
				dwr.engine.setAsync(true);
				carType.style.display = "block";
			}
			function save(){
				var brand = document.getElementById("brand").value;
				var department = document.getElementById("department").value;
				var carType = document.getElementById("carType").value;
				var mileage = document.getElementById("mileage").value;
				var money = document.getElementById("money").value;
				var color = document.getElementById("color").value;
				var content = document.getElementById("content").value;
				var name = document.getElementById("name").value;
				var telephone = document.getElementById("telephone").value;
				if(brand==0||department==0||carType==0||mileage.trim()==""||money.trim()==""||color==0||content.trim()==""||name.trim()==""||telephone.trim()==""){
					alert("请将打*号的内容填写完整");
					return;
				}
				document.getElementById("form").submit();
			}
			
			function show1(){
				document.getElementById("file2").style.display = "block";
			}
			function show2(){
				document.getElementById("file3").style.display = "block";
			}
		</script>

	</head>
	<body>
		<div id="main">
			<form id="form" action="usedcar/viewSaleUsedCar_save" method="post">
				<div id="contentPost" class="mb15">
					<table cellpadding="0" cellspacing="0" class="formTable">
						<tr style="height: 40px;">
							<th class="pt18">
								<em class="red">*</em>品牌
							</th>
							<td>
								<table><tr><td>
								<select id="brand" name="brand" style="font-size: 14px; text-align: center;width:160" onchange="brandChange(this.options[this.options.selectedIndex].value);">
									<option value="0">
										请选择
									</option>
									<s:iterator var='brand' value="#request.brands">
										<option>
											<s:property value="#brand" />
										</option>
									</s:iterator>
								</select></td><td>
								<select id="department" name="department" style="display: none; text-align: center;width:160"
									onchange="departmentChange(this.options[this.options.selectedIndex].value);">
									<option value="0">
										请选择
									</option>
								</select></td><td>
								<select id="carType" name="carType" style="display: none; text-align: center;width:160">
									<option value="0">
										请选择
									</option>
								</select>
								</td></tr>
								</table>
							</td>
						</tr>
						<tr>
							<th>
								上传图片
							</th>
							<td>
							 <input type="FILE" class="txt w106" name="FILE" size="20" id="file1" onchange="show1()">
							 <input type="FILE" class="txt w106" name="FILE" size="20" id="file2" onchange="show2()" style="display: none">
							 <input type="FILE" class="txt w106" name="FILE" size="20" id="file3" style="display: none">
							</td>
						</tr>
						<tr>
							<th>
								<em class="red">*</em>行驶里程
							</th>
							<td>
								<div class="mb10">
									<input type="text" id="mileage" name="mileage" class="txt w106"
										id="rundistance" maxlength="6">
									万公里
									<span id="rundistance_Tip"></span>
								</div>
							</td>
						</tr>
						<tr>
							<th>
								<em class="red">*</em>转让价格
							</th>
							<td>
								<div class="mb10">
									<input type="text" maxlength="6" id="money" name="money" class="txt w106" />
									万元
									<span id="MinPrice_Tip"></span>
								</div>
							</td>
						</tr>
						<tr id="_hangqingtrID" style="display: none;"></tr>
						<tr>
							<th class="pt18">
								一句话广告
							</th>
							<td>
								<input type="text" value="" maxlength="15" id="intro" name="intro"
									class="txt w400">
								<span id="titleEnd_Tip"></span>
						</tr>
						<tr>
							<th><em class="red">*</em>颜色</th>
							<td><select style="width:160;text-align: center;" name="color" id="color"><option value="0">请选择</option><option>黑</option><option>白</option><option>蓝</option>
    			<option>红</option><option>银</option><option>黄</option><option>灰</option> </select></td>
						</tr>
						<tr>
							<th><em class="red">*</em>购买时间</th>
							<td><input id="buyDate" name="buyDate" type="text" size="15" readonly="readonly" value="${request.buyDate}">
 		<a href="javascript:void(0)" onclick="gfPop.fPopCalendar(document.getElementById('buyDate'));return false;">
    	<img name="popcal" align="absmiddle" src="images/selectDate.gif" width="15" height="12" border="0" alt=""></a></td>
						</tr>
						<tr>
							<th>
								<em class="red">*</em>补充说明
							</th>
							<td>
								<div id="div_htmleditor"></div>
								<textarea id="content" id="content" name="content" class="txtareaw513" rows="2" cols="30"></textarea>
								<span id="Content_Tip"></span>
								<div id="divContentValue" style="display: none;"></div>
							</td>
						</tr>
						<tr>
							<th class="pt18">
								<em class="red">*</em>联系人
							</th>
							<td>
								<input type="text" name="name" id="name"
									 class="txt w106" maxlength="6" />
								&nbsp;
								<span style="display: none;"> <input class="base"
										type="checkbox" value="1" name="IsBiz" /> </span>
							</td>
						</tr>
						<tr>
							<th class="pt18">
								<em class="red">*</em> 联系电话
							</th>
							<td>
								<input class="txt w160" type="text" id="telephone" name="telephone" />
								<span id="Phone_Tip"></span>
							</td>
						</tr>
						<tr>
						<tr>
							<th class="pt18">
								<em class="red">*</em> 保养状况
							</th>
							<td>
							<select id="isMaintain" name="isMaintain">
								<option value="0">无4S店保养</option>
								<option value="1">定期4S店保养</option>
							</select>	
							</td>
						</tr>
						<tr>
						<tr>
							<th class="pt18">
								<em class="red">*</em> 事故状况
							</th>
							<td>
							<select id="isAccident" name="isAccident">
								<option value="0">无重大事故</option>
								<option value="1">有重大事故</option>
							</select>	
							</td>
						</tr>
						<tr>
							<th class="pt18">
								<em class="red">*</em> 外观状况
							</th>
							<td>
							<select id="isAppearance" name="isAppearance">
								<option value="0">成色极新</option>
								<option value="1">成色较新</option>
								<option value="2">成色一般</option>
								<option value="3">成色较差</option>
							</select>	
							</td>
						</tr>
						<tr>
							<th class="pt18">
								<em class="red">*</em> 内饰状况
							</th>
							<td>
							<select id="isInterior" name="isInterior">
								<option value="0">内饰有缺陷</option>
								<option value="1">内饰完好</option>
							</select>	
							</td>
						</tr>
						<tr>
							<th class="pt18">
								<em class="red">*</em> 证件状况
							</th>
							<td>
							<select id="isCertificate" name="isCertificate">
								<option value="0">证件不齐全</option>
								<option value="1">证件齐全</option>
							</select>	
							</td>
						</tr>
						<tr>
							<th class="pt18">
								<em class="red">*</em> 年检到期
							</th>
							<td>
								<input id="annualDate" name="annualDate" type="text" size="15" readonly="readonly" value="${request.annualDate}">
 		<a href="javascript:void(0)" onclick="gfPop.fPopCalendar(document.getElementById('annualDate'));return false;">
    	<img name="popcal" align="absmiddle" src="images/selectDate.gif" width="15" height="12" border="0" alt=""></a>
							</td>
						</tr>
						<tr>
							<th class="pt18">
								<em class="red">*</em> 交强险到期
							</th>
							<td>
							<input id="compulsoryDate" name="compulsoryDate" type="text" size="15" readonly="readonly" value="${request.compulsoryDate}">
 		<a href="javascript:void(0)" onclick="gfPop.fPopCalendar(document.getElementById('compulsoryDate'));return false;">
    	<img name="popcal" align="absmiddle" src="images/selectDate.gif" width="15" height="12" border="0" alt=""></a>
							</td>
						</tr>
						<tr>
          <td class="t"></td>
          <td><input type="button" id="fabu" onclick="save()" class="fabu1" value="确定" ct="submit" />
                       </td>
        </tr>
					</table>
					<br/>
					<br/>
					<br/>
					<br/>
					<br/>
				</div>
			</form>
		</div>
	<iframe width=174 height=189 name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="common/calendar/ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; left:-500px; top:0px;"></iframe>
	</body>
</html>
